Skip to content

Make error and snapshot tests multi-version aware#3685

Merged
kddnewton merged 1 commit into
ruby:mainfrom
Earlopain:multi-version-testing
Oct 22, 2025
Merged

Make error and snapshot tests multi-version aware#3685
kddnewton merged 1 commit into
ruby:mainfrom
Earlopain:multi-version-testing

Conversation

@Earlopain

Copy link
Copy Markdown
Collaborator

This one has been on my mind for a while now.

Currently, there are only tests against the latest syntax version.

This changes the snapshot structure as follows:

  • Snapshots at their current location are tested against all syntax versions
  • Snapshots inside a version folder like "3.3" are tested against all versions starting from that version
  • Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range.

This makes sure that as new syntax is added, older versions still work as expected. I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well)

These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds.

@Earlopain
Earlopain force-pushed the multi-version-testing branch 3 times, most recently from 2ba94ed to 58cee4f Compare October 17, 2025 14:17
This one has been on my mind for a while now.

Currently, there are only tests against the latest syntax version.

This changes the snapshot structure as follows:
* Snapshots at their current location are tested against all syntax versions
* Snapshots inside a version folder like "3.3" are tested against all versions starting from that version
* Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range.

This makes sure that as new syntax is added, older versions still work as expected.
I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well)

These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds.
@Earlopain
Earlopain force-pushed the multi-version-testing branch from 58cee4f to 5191b1a Compare October 17, 2025 14:20
@Earlopain

Copy link
Copy Markdown
Collaborator Author

This did find an inconsequential bug where class << A; return; end was not accepted on Ruby 3.3, ruby/ruby#11234 changed it without a version check. It's whatever for 3.3 syntax, but basically this is why I want to do this.

@Earlopain
Earlopain marked this pull request as ready for review October 17, 2025 14:26

@kddnewton kddnewton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks good. I'm glad it found something.

I'll merge it tomorrow when I can watch the sync to make sure nothing goes wrong.

@kddnewton
kddnewton merged commit 17a6a19 into ruby:main Oct 22, 2025
60 checks passed
@Earlopain
Earlopain deleted the multi-version-testing branch December 3, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants